package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.ClientBean;
import com.project.service.IClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Title: ClientController
 * @Package: com.project.controller
 * @Description:
 * @Author: Liang-Xie
 */
@SuppressWarnings("all")
@RestController
@RequestMapping("client")
public class ClientController {
    @Autowired
    private IClientService clientService;

    @RequestMapping("findByItem")
    public IPage<ClientBean> findByItem(Integer pageNO, String name, String scope) {
        return clientService.findByItem(pageNO, name, scope);
    }
    @RequestMapping("findById")
    public ClientBean findById(Integer clientId){
        return clientService.findById(clientId);
    }
    @RequestMapping("update")
    public String update(Integer clientId, String person, String phone, String scope) {
        clientService.update(clientId, person, phone, scope);
        return "ok";
    }
    @RequestMapping("add")
    public String add(ClientBean client){
        clientService.add(client);
        return "ok";
    }
    @RequestMapping("findAll")
    public List<ClientBean> findAll(){
        return clientService.findAll();
    }
}
